/**
 * Created by Administrator on 2017/11/1.
 */
module  zysx {
    export class StageMgr {
        private static lastOrientation:string|number;
        public static STAGE_RESIZE: string = "stage_resize";           //舞台尺寸发生变化
        public static STAGE_ACTIVE: string = "stage_active";           //当舞台获得焦点
        public static STAGE_DEACTIVATE: string = "stage_deactivate";   //当舞台失去焦点
        public static stage: egret.Stage;
        /**
         * @description 获取舞台宽度
         */
        public static get stageWidth() {
            return this.stage.stageWidth;
        }
        /**
         * @description 获取舞台高度
         */
        public static get stageHeight(): number {
            return this.stage.stageHeight;
        }
        public static getScaleMode():string{
            let scale;
            if(window.innerHeight > window.innerWidth) 
            scale = window.innerHeight / window.innerWidth; 
            else scale = window.innerWidth / window.innerHeight; 
            let minSizeProb = 1.6;
            let scaleMode = "";
            if(scale <= minSizeProb) {
                scaleMode = egret.StageScaleMode.FIXED_HEIGHT;
            } else {
                scaleMode = egret.StageScaleMode.FIXED_WIDTH;
            } 
            return scaleMode;
        }
        public static init(stage:egret.Stage):void{

            this.stage = stage;
            this.stage.scaleMode = this.getScaleMode();
        

            
        }
    }
}